package com.zsh.demoreactor.reactor8;

import org.omg.PortableInterceptor.INACTIVE;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author zsh
 * @Description
 * @create 2022-03-07 16:29
 */
public class TestReactor {

    public static void main(String[] args) {
        //just 最简单的声明数据流的方式
        Flux.just(1,2,3,4).subscribe(System.out::print);
        Mono.just(1).subscribe(System.out::print);

        //其他方法
        //数组形式
        Integer[] array = {1,2,3,4};
        Flux.fromArray(array).subscribe(System.out::print);

        //集合形式
        List<Integer> list = Arrays.asList(array);
        Flux.fromIterable(list).subscribe(System.out::print);

        //流形式
        Stream<Integer> stream = list.stream();
        Flux.fromStream(stream).subscribe(System.out::print);
    }
}
